<?php
class homeComponents extends sfComponents
{
	public function executeMainMenu() {
		$list = TMDService::listGeoRegions( array( 'language'=> 'THAI' ) );
		$this->regions = $list;
	}


	public function executeWeatherBox() {
		
		$weatherTypes = array();
		$types = TMDService::findAllWeatherTypes();
		if( $types && count( $types ) > 0 ) {
			foreach ( $types as $type ) {
				$weatherTypes[$type->getIweatherType()] = $type;
			}
		}
		
		$provinceId = 37;
		if( isset( $this->provinceId ) && $this->provinceId != '' ) {
			$provinceId = $this->provinceId;
		}
		
		
		TMDService::alert( $provinceId );
		
		$this->province = ProvincesPeer::retrieveByPK( $provinceId );
		$this->weatherTypes = $weatherTypes;
		$this->forecasts = TMDService::findInputSevenDaysForecastByProvince( array( "provinceId" => $provinceId ) );
	}


	public function executeQuickLink() {

	}


	public function executeHomeWeatherBox() {

	}

	public function executeFooterSlideBox() {

	}
}